<span class='l l-1 source c++'><s class='meta preprocessor c include' data-entity-scope='meta.preprocessor.c.include'>#<s class='keyword control import include c' data-entity-scope='keyword.control.import.include.c'>include</s> <s class='string quoted double include c' data-entity-scope='string.quoted.double.include.c'><s class='punctuation definition string begin c' data-entity-scope='punctuation.definition.string.begin.c'>&quot;</s>ContactsModel.h<s class='punctuation definition string end c' data-entity-scope='punctuation.definition.string.end.c'>&quot;</s></s></s>
</span><span class='l l-2 source c++'><s class='meta preprocessor c include' data-entity-scope='meta.preprocessor.c.include'>#<s class='keyword control import include c' data-entity-scope='keyword.control.import.include.c'>include</s> <s class='string quoted double include c' data-entity-scope='string.quoted.double.include.c'><s class='punctuation definition string begin c' data-entity-scope='punctuation.definition.string.begin.c'>&quot;</s>core/IdentityManager.h<s class='punctuation definition string end c' data-entity-scope='punctuation.definition.string.end.c'>&quot;</s></s></s>
</span><span class='l l-3 source c++'><s class='meta preprocessor c include' data-entity-scope='meta.preprocessor.c.include'>#<s class='keyword control import include c' data-entity-scope='keyword.control.import.include.c'>include</s> <s class='string quoted double include c' data-entity-scope='string.quoted.double.include.c'><s class='punctuation definition string begin c' data-entity-scope='punctuation.definition.string.begin.c'>&quot;</s>core/ContactsManager.h<s class='punctuation definition string end c' data-entity-scope='punctuation.definition.string.end.c'>&quot;</s></s></s>
</span><span class='l l-4 source c++'><s class='meta preprocessor c include' data-entity-scope='meta.preprocessor.c.include'>#<s class='keyword control import include c' data-entity-scope='keyword.control.import.include.c'>include</s> <s class='string quoted other lt-gt include c' data-entity-scope='string.quoted.other.lt-gt.include.c'><s class='punctuation definition string begin c' data-entity-scope='punctuation.definition.string.begin.c'>&lt;</s>QDebug<s class='punctuation definition string end c' data-entity-scope='punctuation.definition.string.end.c'>&gt;</s></s></s>
</span><span class='l l-5 source c++'>
</span><span class='l l-6 source c++'><s class='storage modifier c' data-entity-scope='storage.modifier.c'>inline</s> <s class='storage type c' data-entity-scope='storage.type.c'>bool</s><s class='meta function c' data-entity-scope='meta.function.c'><s class='punctuation whitespace function leading c' data-entity-scope='punctuation.whitespace.function.leading.c'> </s><s class='entity name function c' data-entity-scope='entity.name.function.c'>contactSort</s><s class='meta parens c' data-entity-scope='meta.parens.c'>(<s class='storage modifier c' data-entity-scope='storage.modifier.c'>const</s> ContactUser *c1, <s class='storage modifier c' data-entity-scope='storage.modifier.c'>const</s> ContactUser *c2)</s>
</span><span class='l l-7 source c++'><s class='meta block c' data-entity-scope='meta.block.c'>{
</span><span class='l l-8 source c++'>    <s class='keyword control c' data-entity-scope='keyword.control.c'>if</s><s class='meta initialization c' data-entity-scope='meta.initialization.c'> <s class='punctuation definition parameters c' data-entity-scope='punctuation.definition.parameters.c'>(</s></s>c1-&gt;<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>status</s>(</s>) != c2-&gt;<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>status</s>(</s>))
</span><span class='l l-9 source c++'>        <s class='keyword control c' data-entity-scope='keyword.control.c'>return</s> c1-&gt;<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>status</s>(</s>) &lt; c2-&gt;<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>status</s>(</s>);
</span><span class='l l-10 source c++'>    <s class='keyword control c' data-entity-scope='keyword.control.c'>return</s> c1-&gt;<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>nickname</s>(</s>).<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>localeAwareCompare</s>(</s>c2-&gt;<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>nickname</s>(</s>)) &lt; <s class='constant numeric c' data-entity-scope='constant.numeric.c'>0</s>;
</span><span class='l l-11 source c++'>}</s></s>
</span><span class='l l-12 source c++'>
</span><span class='l l-13 source c++'><s class='meta function c' data-entity-scope='meta.function.c'><s class='entity name function c' data-entity-scope='entity.name.function.c'>ContactsModel::ContactsModel</s><s class='meta parens c' data-entity-scope='meta.parens.c'>(QObject *parent)</s>
</span><span class='l l-14 source c++'>    : QAbstractListModel<s class='meta parens c' data-entity-scope='meta.parens.c'>(parent)</s>, m_identity<s class='meta parens c' data-entity-scope='meta.parens.c'>(<s class='constant numeric c' data-entity-scope='constant.numeric.c'>0</s>)</s>
</span><span class='l l-15 source c++'><s class='meta block c' data-entity-scope='meta.block.c'>{
</span><span class='l l-16 source c++'>}</s></s>
</span><span class='l l-17 source c++'>
</span><span class='l l-18 source c++'><s class='storage type c' data-entity-scope='storage.type.c'>void</s><s class='meta function c' data-entity-scope='meta.function.c'><s class='punctuation whitespace function leading c' data-entity-scope='punctuation.whitespace.function.leading.c'> </s><s class='entity name function c' data-entity-scope='entity.name.function.c'>ContactsModel::setIdentity</s><s class='meta parens c' data-entity-scope='meta.parens.c'>(UserIdentity *identity)</s>
</span><span class='l l-19 source c++'><s class='meta block c' data-entity-scope='meta.block.c'>{
</span><span class='l l-20 source c++'>    <s class='keyword control c' data-entity-scope='keyword.control.c'>if</s><s class='meta initialization c' data-entity-scope='meta.initialization.c'> <s class='punctuation definition parameters c' data-entity-scope='punctuation.definition.parameters.c'>(</s></s>identity == m_identity)
</span><span class='l l-21 source c++'>        <s class='keyword control c' data-entity-scope='keyword.control.c'>return</s>;
</span><span class='l l-22 source c++'>
</span><span class='l l-23 source c++'><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'>    </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>beginResetModel</s>(</s>);
</span><span class='l l-24 source c++'>
</span><span class='l l-25 source c++'><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'>    </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>foreach</s> (</s>ContactUser *user, contacts)
</span><span class='l l-26 source c++'>        user-&gt;<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>disconnect</s>(</s>this);
</span><span class='l l-27 source c++'>    contacts.<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>clear</s>(</s>);
</span><span class='l l-28 source c++'>
</span><span class='l l-29 source c++'>    <s class='keyword control c' data-entity-scope='keyword.control.c'>if</s><s class='meta initialization c' data-entity-scope='meta.initialization.c'> <s class='punctuation definition parameters c' data-entity-scope='punctuation.definition.parameters.c'>(</s></s>m_identity) <s class='meta block c' data-entity-scope='meta.block.c'>{
</span><span class='l l-30 source c++'><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'>        </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>disconnect</s>(</s>m_identity, <s class='constant numeric c' data-entity-scope='constant.numeric.c'>0</s>, this, <s class='constant numeric c' data-entity-scope='constant.numeric.c'>0</s>);
</span><span class='l l-31 source c++'><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'>        </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>disconnect</s>(</s>&amp;m_identity-&gt;contacts, <s class='constant numeric c' data-entity-scope='constant.numeric.c'>0</s>, this, <s class='constant numeric c' data-entity-scope='constant.numeric.c'>0</s>);
</span><span class='l l-32 source c++'>    }</s>
</span><span class='l l-33 source c++'>
</span><span class='l l-34 source c++'>    m_identity = identity;
</span><span class='l l-35 source c++'>
</span><span class='l l-36 source c++'>    <s class='keyword control c' data-entity-scope='keyword.control.c'>if</s><s class='meta initialization c' data-entity-scope='meta.initialization.c'> <s class='punctuation definition parameters c' data-entity-scope='punctuation.definition.parameters.c'>(</s></s>m_identity) <s class='meta block c' data-entity-scope='meta.block.c'>{
</span><span class='l l-37 source c++'><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'>        </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>connect</s>(</s>&amp;identity-&gt;contacts,<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'> </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>SIGNAL</s>(</s><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>contactAdded</s>(</s>ContactUser*)),<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'> </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>SLOT</s>(</s><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>contactAdded</s>(</s>ContactUser*)));
</span><span class='l l-38 source c++'>
</span><span class='l l-39 source c++'>        contacts = identity-&gt;contacts.<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>contacts</s>(</s>);
</span><span class='l l-40 source c++'><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'>        </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>std::sort</s>(</s>contacts.<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>begin</s>(</s>), contacts.<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>end</s>(</s>), contactSort);
</span><span class='l l-41 source c++'>
</span><span class='l l-42 source c++'><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'>        </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>foreach</s> (</s>ContactUser *user, contacts)
</span><span class='l l-43 source c++'><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'>            </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>connectSignals</s>(</s>user);
</span><span class='l l-44 source c++'>    }</s>
</span><span class='l l-45 source c++'>
</span><span class='l l-46 source c++'><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'>    </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>endResetModel</s>(</s>);
</span><span class='l l-47 source c++'>    emit<s class='meta initialization c' data-entity-scope='meta.initialization.c'> <s class='variable other c' data-entity-scope='variable.other.c'>identityChanged</s><s class='punctuation definition parameters c' data-entity-scope='punctuation.definition.parameters.c'>(</s></s>);
</span><span class='l l-48 source c++'>}</s></s>
</span><span class='l l-49 source c++'>
</span><span class='l l-50 source c++'>QModelIndex<s class='meta function c' data-entity-scope='meta.function.c'><s class='punctuation whitespace function leading c' data-entity-scope='punctuation.whitespace.function.leading.c'> </s><s class='entity name function c' data-entity-scope='entity.name.function.c'>ContactsModel::indexOfContact</s><s class='meta parens c' data-entity-scope='meta.parens.c'>(ContactUser *user)</s> <s class='storage modifier c' data-entity-scope='storage.modifier.c'>const</s>
</span><span class='l l-51 source c++'><s class='meta block c' data-entity-scope='meta.block.c'>{
</span><span class='l l-52 source c++'>    <s class='storage type c' data-entity-scope='storage.type.c'>int</s> row = contacts.<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>indexOf</s>(</s>user);
</span><span class='l l-53 source c++'>    <s class='keyword control c' data-entity-scope='keyword.control.c'>if</s><s class='meta initialization c' data-entity-scope='meta.initialization.c'> <s class='punctuation definition parameters c' data-entity-scope='punctuation.definition.parameters.c'>(</s></s>row &lt; <s class='constant numeric c' data-entity-scope='constant.numeric.c'>0</s>)
</span><span class='l l-54 source c++'>        <s class='keyword control c' data-entity-scope='keyword.control.c'>return</s><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'> </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>QModelIndex</s>(</s>);
</span><span class='l l-55 source c++'>    <s class='keyword control c' data-entity-scope='keyword.control.c'>return</s><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'> </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>index</s>(</s>row, <s class='constant numeric c' data-entity-scope='constant.numeric.c'>0</s>);
</span><span class='l l-56 source c++'>}</s></s>
</span><span class='l l-57 source c++'>
</span><span class='l l-58 source c++'>ContactUser *<s class='meta function c' data-entity-scope='meta.function.c'><s class='entity name function c' data-entity-scope='entity.name.function.c'>ContactsModel::contact</s><s class='meta parens c' data-entity-scope='meta.parens.c'>(<s class='storage type c' data-entity-scope='storage.type.c'>int</s> row)</s> <s class='storage modifier c' data-entity-scope='storage.modifier.c'>const</s>
</span><span class='l l-59 source c++'><s class='meta block c' data-entity-scope='meta.block.c'>{
</span><span class='l l-60 source c++'>    <s class='keyword control c' data-entity-scope='keyword.control.c'>return</s> contacts.<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>value</s>(</s>row);
</span><span class='l l-61 source c++'>}</s></s>
</span><span class='l l-62 source c++'>
</span><span class='l l-63 source c++'><s class='storage type c' data-entity-scope='storage.type.c'>void</s><s class='meta function c' data-entity-scope='meta.function.c'><s class='punctuation whitespace function leading c' data-entity-scope='punctuation.whitespace.function.leading.c'> </s><s class='entity name function c' data-entity-scope='entity.name.function.c'>ContactsModel::updateUser</s><s class='meta parens c' data-entity-scope='meta.parens.c'>(ContactUser *user)</s>
</span><span class='l l-64 source c++'><s class='meta block c' data-entity-scope='meta.block.c'>{
</span><span class='l l-65 source c++'>    <s class='keyword control c' data-entity-scope='keyword.control.c'>if</s><s class='meta initialization c' data-entity-scope='meta.initialization.c'> <s class='punctuation definition parameters c' data-entity-scope='punctuation.definition.parameters.c'>(</s></s>!user)
</span><span class='l l-66 source c++'>    <s class='meta block c' data-entity-scope='meta.block.c'>{
</span><span class='l l-67 source c++'>        user = qobject_cast&lt;ContactUser*&gt;(<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>sender</s>(</s>));
</span><span class='l l-68 source c++'>        <s class='keyword control c' data-entity-scope='keyword.control.c'>if</s><s class='meta initialization c' data-entity-scope='meta.initialization.c'> <s class='punctuation definition parameters c' data-entity-scope='punctuation.definition.parameters.c'>(</s></s>!user)
</span><span class='l l-69 source c++'>            <s class='keyword control c' data-entity-scope='keyword.control.c'>return</s>;
</span><span class='l l-70 source c++'>    }</s>
</span><span class='l l-71 source c++'>
</span><span class='l l-72 source c++'>    <s class='storage type c' data-entity-scope='storage.type.c'>int</s> row = contacts.<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>indexOf</s>(</s>user);
</span><span class='l l-73 source c++'>    <s class='keyword control c' data-entity-scope='keyword.control.c'>if</s><s class='meta initialization c' data-entity-scope='meta.initialization.c'> <s class='punctuation definition parameters c' data-entity-scope='punctuation.definition.parameters.c'>(</s></s>row &lt; <s class='constant numeric c' data-entity-scope='constant.numeric.c'>0</s>)
</span><span class='l l-74 source c++'>    <s class='meta block c' data-entity-scope='meta.block.c'>{
</span><span class='l l-75 source c++'>        user-&gt;<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>disconnect</s>(</s>this);
</span><span class='l l-76 source c++'>        <s class='keyword control c' data-entity-scope='keyword.control.c'>return</s>;
</span><span class='l l-77 source c++'>    }</s>
</span><span class='l l-78 source c++'>
</span><span class='l l-79 source c++'>    QList&lt;ContactUser*&gt; sorted = contacts;
</span><span class='l l-80 source c++'><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'>    </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>std::sort</s>(</s>sorted.<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>begin</s>(</s>), sorted.<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>end</s>(</s>), contactSort);
</span><span class='l l-81 source c++'>    <s class='storage type c' data-entity-scope='storage.type.c'>int</s> newRow = sorted.<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>indexOf</s>(</s>user);
</span><span class='l l-82 source c++'>
</span><span class='l l-83 source c++'>    <s class='keyword control c' data-entity-scope='keyword.control.c'>if</s><s class='meta initialization c' data-entity-scope='meta.initialization.c'> <s class='punctuation definition parameters c' data-entity-scope='punctuation.definition.parameters.c'>(</s></s>row != newRow)
</span><span class='l l-84 source c++'>    <s class='meta block c' data-entity-scope='meta.block.c'>{
</span><span class='l l-85 source c++'><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'>        </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>beginMoveRows</s>(</s><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>QModelIndex</s>(</s>), row, row,<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'> </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>QModelIndex</s>(</s>), (newRow &gt; row) ? (newRow+<s class='constant numeric c' data-entity-scope='constant.numeric.c'>1</s>) : newRow);
</span><span class='l l-86 source c++'>        contacts = sorted;
</span><span class='l l-87 source c++'><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'>        </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>endMoveRows</s>(</s>);
</span><span class='l l-88 source c++'>    }</s>
</span><span class='l l-89 source c++'>    emit<s class='meta initialization c' data-entity-scope='meta.initialization.c'> <s class='variable other c' data-entity-scope='variable.other.c'>dataChanged</s><s class='punctuation definition parameters c' data-entity-scope='punctuation.definition.parameters.c'>(</s></s><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>index</s>(</s>newRow, <s class='constant numeric c' data-entity-scope='constant.numeric.c'>0</s>),<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'> </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>index</s>(</s>newRow, <s class='constant numeric c' data-entity-scope='constant.numeric.c'>0</s>));
</span><span class='l l-90 source c++'>}</s></s>
</span><span class='l l-91 source c++'>
</span><span class='l l-92 source c++'><s class='storage type c' data-entity-scope='storage.type.c'>void</s><s class='meta function c' data-entity-scope='meta.function.c'><s class='punctuation whitespace function leading c' data-entity-scope='punctuation.whitespace.function.leading.c'> </s><s class='entity name function c' data-entity-scope='entity.name.function.c'>ContactsModel::connectSignals</s><s class='meta parens c' data-entity-scope='meta.parens.c'>(ContactUser *user)</s>
</span><span class='l l-93 source c++'><s class='meta block c' data-entity-scope='meta.block.c'>{
</span><span class='l l-94 source c++'><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'>    </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>connect</s>(</s>user,<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'> </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>SIGNAL</s>(</s><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>statusChanged</s>(</s>)),<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'> </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>SLOT</s>(</s><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>updateUser</s>(</s>)));
</span><span class='l l-95 source c++'><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'>    </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>connect</s>(</s>user,<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'> </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>SIGNAL</s>(</s><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>nicknameChanged</s>(</s>)),<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'> </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>SLOT</s>(</s><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>updateUser</s>(</s>)));
</span><span class='l l-96 source c++'><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'>    </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>connect</s>(</s>user,<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'> </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>SIGNAL</s>(</s><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>contactDeleted</s>(</s>ContactUser*)),<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'> </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>SLOT</s>(</s><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>contactRemoved</s>(</s>ContactUser*)));
</span><span class='l l-97 source c++'>}</s></s>
</span><span class='l l-98 source c++'>
</span><span class='l l-99 source c++'><s class='storage type c' data-entity-scope='storage.type.c'>void</s><s class='meta function c' data-entity-scope='meta.function.c'><s class='punctuation whitespace function leading c' data-entity-scope='punctuation.whitespace.function.leading.c'> </s><s class='entity name function c' data-entity-scope='entity.name.function.c'>ContactsModel::contactAdded</s><s class='meta parens c' data-entity-scope='meta.parens.c'>(ContactUser *user)</s>
</span><span class='l l-100 source c++'><s class='meta block c' data-entity-scope='meta.block.c'>{
</span><span class='l l-101 source c++'><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'>    </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>Q_ASSERT</s>(</s>!<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>indexOfContact</s>(</s>user).<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>isValid</s>(</s>));
</span><span class='l l-102 source c++'>
</span><span class='l l-103 source c++'><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'>    </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>connectSignals</s>(</s>user);
</span><span class='l l-104 source c++'>
</span><span class='l l-105 source c++'>    QList&lt;ContactUser*&gt;::Iterator lp =<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'> </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>qLowerBound</s>(</s>contacts.<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>begin</s>(</s>), contacts.<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>end</s>(</s>), user, contactSort);
</span><span class='l l-106 source c++'>    <s class='storage type c' data-entity-scope='storage.type.c'>int</s> row = lp - contacts.<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>begin</s>(</s>);
</span><span class='l l-107 source c++'>
</span><span class='l l-108 source c++'><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'>    </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>beginInsertRows</s>(</s><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>QModelIndex</s>(</s>), row, row);
</span><span class='l l-109 source c++'>    contacts.<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>insert</s>(</s>lp, user);
</span><span class='l l-110 source c++'><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'>    </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>endInsertRows</s>(</s>);
</span><span class='l l-111 source c++'>}</s></s>
</span><span class='l l-112 source c++'>
</span><span class='l l-113 source c++'><s class='storage type c' data-entity-scope='storage.type.c'>void</s><s class='meta function c' data-entity-scope='meta.function.c'><s class='punctuation whitespace function leading c' data-entity-scope='punctuation.whitespace.function.leading.c'> </s><s class='entity name function c' data-entity-scope='entity.name.function.c'>ContactsModel::contactRemoved</s><s class='meta parens c' data-entity-scope='meta.parens.c'>(ContactUser *user)</s>
</span><span class='l l-114 source c++'><s class='meta block c' data-entity-scope='meta.block.c'>{
</span><span class='l l-115 source c++'>    <s class='keyword control c' data-entity-scope='keyword.control.c'>if</s><s class='meta initialization c' data-entity-scope='meta.initialization.c'> <s class='punctuation definition parameters c' data-entity-scope='punctuation.definition.parameters.c'>(</s></s>!user &amp;&amp; !(user = qobject_cast&lt;ContactUser*&gt;(<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>sender</s>(</s>))))
</span><span class='l l-116 source c++'>        <s class='keyword control c' data-entity-scope='keyword.control.c'>return</s>;
</span><span class='l l-117 source c++'>
</span><span class='l l-118 source c++'>    <s class='storage type c' data-entity-scope='storage.type.c'>int</s> row = contacts.<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>indexOf</s>(</s>user);
</span><span class='l l-119 source c++'><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'>    </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>beginRemoveRows</s>(</s><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>QModelIndex</s>(</s>), row, row);
</span><span class='l l-120 source c++'>    contacts.<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>removeAt</s>(</s>row);
</span><span class='l l-121 source c++'><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'>    </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>endRemoveRows</s>(</s>);
</span><span class='l l-122 source c++'>
</span><span class='l l-123 source c++'><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'>    </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>disconnect</s>(</s>user, <s class='constant numeric c' data-entity-scope='constant.numeric.c'>0</s>, this, <s class='constant numeric c' data-entity-scope='constant.numeric.c'>0</s>);
</span><span class='l l-124 source c++'>}</s></s>
</span><span class='l l-125 source c++'>
</span><span class='l l-126 source c++'>QHash&lt;<s class='storage type c' data-entity-scope='storage.type.c'>int</s>,QByteArray&gt;<s class='meta function c' data-entity-scope='meta.function.c'><s class='punctuation whitespace function leading c' data-entity-scope='punctuation.whitespace.function.leading.c'> </s><s class='entity name function c' data-entity-scope='entity.name.function.c'>ContactsModel::roleNames</s><s class='meta parens c' data-entity-scope='meta.parens.c'>()</s> <s class='storage modifier c' data-entity-scope='storage.modifier.c'>const</s>
</span><span class='l l-127 source c++'><s class='meta block c' data-entity-scope='meta.block.c'>{
</span><span class='l l-128 source c++'>    QHash&lt;<s class='storage type c' data-entity-scope='storage.type.c'>int</s>, QByteArray&gt; roles;
</span><span class='l l-129 source c++'>    roles[Qt::DisplayRole] = <s class='string quoted double c' data-entity-scope='string.quoted.double.c'><s class='punctuation definition string begin c' data-entity-scope='punctuation.definition.string.begin.c'>&quot;</s>name<s class='punctuation definition string end c' data-entity-scope='punctuation.definition.string.end.c'>&quot;</s></s>;
</span><span class='l l-130 source c++'>    roles[PointerRole] = <s class='string quoted double c' data-entity-scope='string.quoted.double.c'><s class='punctuation definition string begin c' data-entity-scope='punctuation.definition.string.begin.c'>&quot;</s>contact<s class='punctuation definition string end c' data-entity-scope='punctuation.definition.string.end.c'>&quot;</s></s>;
</span><span class='l l-131 source c++'>    roles[StatusRole] = <s class='string quoted double c' data-entity-scope='string.quoted.double.c'><s class='punctuation definition string begin c' data-entity-scope='punctuation.definition.string.begin.c'>&quot;</s>status<s class='punctuation definition string end c' data-entity-scope='punctuation.definition.string.end.c'>&quot;</s></s>;
</span><span class='l l-132 source c++'>    <s class='keyword control c' data-entity-scope='keyword.control.c'>return</s> roles;
</span><span class='l l-133 source c++'>}</s></s>
</span><span class='l l-134 source c++'>
</span><span class='l l-135 source c++'><s class='storage type c' data-entity-scope='storage.type.c'>int</s><s class='meta function c' data-entity-scope='meta.function.c'><s class='punctuation whitespace function leading c' data-entity-scope='punctuation.whitespace.function.leading.c'> </s><s class='entity name function c' data-entity-scope='entity.name.function.c'>ContactsModel::rowCount</s><s class='meta parens c' data-entity-scope='meta.parens.c'>(<s class='storage modifier c' data-entity-scope='storage.modifier.c'>const</s> QModelIndex &amp;parent)</s> <s class='storage modifier c' data-entity-scope='storage.modifier.c'>const</s>
</span><span class='l l-136 source c++'><s class='meta block c' data-entity-scope='meta.block.c'>{
</span><span class='l l-137 source c++'>    <s class='keyword control c' data-entity-scope='keyword.control.c'>if</s><s class='meta initialization c' data-entity-scope='meta.initialization.c'> <s class='punctuation definition parameters c' data-entity-scope='punctuation.definition.parameters.c'>(</s></s>parent.<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>isValid</s>(</s>))
</span><span class='l l-138 source c++'>        <s class='keyword control c' data-entity-scope='keyword.control.c'>return</s> <s class='constant numeric c' data-entity-scope='constant.numeric.c'>0</s>;
</span><span class='l l-139 source c++'>    <s class='keyword control c' data-entity-scope='keyword.control.c'>return</s> contacts.<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>size</s>(</s>);
</span><span class='l l-140 source c++'>}</s></s>
</span><span class='l l-141 source c++'>
</span><span class='l l-142 source c++'>QVariant<s class='meta function c' data-entity-scope='meta.function.c'><s class='punctuation whitespace function leading c' data-entity-scope='punctuation.whitespace.function.leading.c'> </s><s class='entity name function c' data-entity-scope='entity.name.function.c'>ContactsModel::data</s><s class='meta parens c' data-entity-scope='meta.parens.c'>(<s class='storage modifier c' data-entity-scope='storage.modifier.c'>const</s> QModelIndex &amp;index, <s class='storage type c' data-entity-scope='storage.type.c'>int</s> role)</s> <s class='storage modifier c' data-entity-scope='storage.modifier.c'>const</s>
</span><span class='l l-143 source c++'><s class='meta block c' data-entity-scope='meta.block.c'>{
</span><span class='l l-144 source c++'>    <s class='keyword control c' data-entity-scope='keyword.control.c'>if</s><s class='meta initialization c' data-entity-scope='meta.initialization.c'> <s class='punctuation definition parameters c' data-entity-scope='punctuation.definition.parameters.c'>(</s></s>!index.<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>isValid</s>(</s>) || index.<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>row</s>(</s>) &gt;= contacts.<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>size</s>(</s>))
</span><span class='l l-145 source c++'>        <s class='keyword control c' data-entity-scope='keyword.control.c'>return</s><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'> </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>QVariant</s>(</s>);
</span><span class='l l-146 source c++'>
</span><span class='l l-147 source c++'>    ContactUser *user = contacts[index.<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>row</s>(</s>)];
</span><span class='l l-148 source c++'>
</span><span class='l l-149 source c++'>    <s class='keyword control c' data-entity-scope='keyword.control.c'>switch</s><s class='meta initialization c' data-entity-scope='meta.initialization.c'> <s class='punctuation definition parameters c' data-entity-scope='punctuation.definition.parameters.c'>(</s></s>role)
</span><span class='l l-150 source c++'>    <s class='meta block c' data-entity-scope='meta.block.c'>{
</span><span class='l l-151 source c++'>    <s class='keyword control c' data-entity-scope='keyword.control.c'>case</s> Qt::DisplayRole:
</span><span class='l l-152 source c++'>    <s class='keyword control c' data-entity-scope='keyword.control.c'>case</s> Qt::EditRole:
</span><span class='l l-153 source c++'>        <s class='keyword control c' data-entity-scope='keyword.control.c'>return</s> user-&gt;<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>nickname</s>(</s>);
</span><span class='l l-154 source c++'>    <s class='keyword control c' data-entity-scope='keyword.control.c'>case</s> PointerRole:
</span><span class='l l-155 source c++'>        <s class='keyword control c' data-entity-scope='keyword.control.c'>return</s><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'> </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>QVariant::fromValue</s>(</s>user);
</span><span class='l l-156 source c++'>    <s class='keyword control c' data-entity-scope='keyword.control.c'>case</s> StatusRole:
</span><span class='l l-157 source c++'>        <s class='keyword control c' data-entity-scope='keyword.control.c'>return</s> user-&gt;<s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>status</s>(</s>);
</span><span class='l l-158 source c++'>    }</s>
</span><span class='l l-159 source c++'>
</span><span class='l l-160 source c++'>    <s class='keyword control c' data-entity-scope='keyword.control.c'>return</s><s class='meta function-call c' data-entity-scope='meta.function-call.c'><s class='punctuation whitespace function-call leading c' data-entity-scope='punctuation.whitespace.function-call.leading.c'> </s><s class='support function any-method c' data-entity-scope='support.function.any-method.c'>QVariant</s>(</s>);
</span><span class='l l-161 source c++'>}</s></s></span>
